package com.txunda.zhuohired.aty.user.my;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.TextView;

import com.ants.theantsgo.util.JSONUtils;
import com.bumptech.glide.Glide;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.txunda.zhuohired.R;
import com.txunda.zhuohired.base.BaseAty;
import com.txunda.zhuohired.http.pst.InfoPst;
import com.txunda.zhuohired.util.GlideCircleTransform;

import java.util.Map;

/**
 * 创建人： Txd_Cjh
 * 创建时间： 2018/3/9 17:14
 * 功能描述：关于我们
 * 联系方式：jiahuanchen@126.com
 */

public class AboutUsAty extends BaseAty {
    /**
     * 标题
     */
    @ViewInject(R.id.tv_layout_white_center)
    private TextView tv_layout_white_center;
    @ViewInject(R.id.iv_img)
    private ImageView iv_img;
    @ViewInject(R.id.tv_com_names)
    private TextView tv_com_names;
    @ViewInject(R.id.tv_version)
    private TextView tv_version;
    @ViewInject(R.id.tv_banquan)
    private TextView tv_banquan;


    private InfoPst infoPst;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        showStatusBar(R.id.layout_white_head);
        tv_layout_white_center.setText("关于我们");
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.aty_about_us;
    }

    @Override
    protected void initialized() {
        infoPst = new InfoPst(this);
    }

    @Override
    protected void requestData() {
        infoPst.aboutUs();
    }

    @Override
    public void onComplete(String requestUrl, String jsonStr) {
        super.onComplete(requestUrl, jsonStr);

        Map<String, String> map = JSONUtils.parseKeyAndValueToMap(jsonStr);

        Map<String, String> data = JSONUtils.parseKeyAndValueToMap(map.get("data"));

        if (map.get("code").equals("1")) {
            tv_com_names.setText(data.get("company_name"));
            tv_banquan.setText(data.get("copyright"));
            tv_version.setText(data.get("version"));

            Glide.with(this).load(data.get("head_pic"))
                    .transform(new GlideCircleTransform(AboutUsAty.this))
                    .dontAnimate()
                    .into(iv_img);
        }
    }
}
